/*
 *      point.cpp
 *      
 *      Copyright 2009 Víctor Manuel Ochoa <kanito8a@gmail.com>
 *      
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *      
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *      
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */


#include "point.h"


Point::Point(): Entity()
{
	
}


Point::~Point()
{
	
}


bool Point::init()
{
	m_physics.init();
	m_physics.setPosition(Vector2(160.f,120.f));
	m_physics.setWidth(TAM);
	m_physics.setHeight(TAM);
	
	Entity::init();
	return true;
}

void Point::update()
{
	setAlive(true);
	m_physics.update();
}

void Point::freeMemory()
{
}

void Point::draw()
{	
	glPushMatrix();
	glLoadIdentity();
	glPointSize(100.f);
	
	const Vector2 *pos=m_physics.getPosition();
	glTranslatef(pos->x,pos->y,0);
	glRotatef(m_physics.getRealAngle(), 0, 0, 1);
    	
	glColor4f(0.f,1.f,1.f,1.f);
	glBindTexture( GL_TEXTURE_2D, 0 );
	
	
	glBegin( GL_QUADS );		
		glVertex2f(-TAM/2,-TAM/2);
		glVertex2f(TAM/2,-TAM/2);
		glVertex2f(TAM/2,TAM/2);		
		glVertex2f(-TAM/2,TAM/2);
	glEnd();
	
	glPopMatrix();
}

